// 创新区账户

import { innovationAssets } from '@/data/mockData.js'

export function innovationFunds() {
  const originalContract = document.querySelectorAll(
    ".mantine-14w8c2f > .mantine-1yvwbt0"
  );
  console.log(originalContract, "originalContract222222");

  const originContractAbout = document.querySelectorAll(
    ".mantine-14w8c2f > .mantine-jehip2"
  );
  console.log(originContractAbout, "originContractAbout111111");
  const contractValue = [
    innovationAssets.spotAssets,
    innovationAssets.accumulatedProfit,
    innovationAssets.tadayProfit
  ];
  const contractValueAbout = [
    innovationAssets.spotAssetsBTC,
    innovationAssets.accumulatedProfitBTC,
    innovationAssets.tadayProfitBTC,
  ];
  originalContract.forEach((item, index) => {
    item.innerHTML = `${contractValue[index].toFixed(2)} USD`;
  });
  originContractAbout.forEach((item, index) => {
    item.innerHTML = `≈${contractValueAbout[index].toFixed(2)} BTC`;
  });
}


import { createApp } from "vue";
import AccountTable from "@/content-scripts/components/fund/AccountTable.vue";
import { innovationTable } from "@/data/mockData";
import { innovationColumns } from "@/content-scripts/components/fund/accountColumns.js";
import Antd from "ant-design-vue";

let innovationApp = null;
// const accountParams = ref({});

export function innovationFundsTable(params = {}) {
  const container = document.querySelector(".mantine-xlwgkm");
  // 请求接口，获取数据
  // params是修改的数据
  console.log(params);
  console.log(container, "contaainer");
  

  if (!container) return;

  const existingOverlay = container.querySelector(".my-innovation-table-overlay");
  if (existingOverlay) {
    existingOverlay.remove();
  }

  const overlay = document.createElement("div");
  overlay.setAttribute("class", "my-innovation-table-overlay");
  overlay.setAttribute(
    "style",
    "position: absolute;\n" +
      " left: 0;\n" +
      " top: 0;\n" +
      " width: 100%;\n" +
      " height: 100%;\n" +
      " z-index: 10;\n"
  );

  const tableStyle = {
    // fontSize: "12px",
    color: "#8e949e",
    background: "#F8F9FB",
  };

  // 挂载元素
  const appContainer = document.createElement("div");

  innovationApp = createApp(AccountTable); // 创建 Vue 应用
  innovationApp.provide("tableSource", innovationTable); // 提供响应式数据
  innovationApp.provide("tableColumns", innovationColumns); // 提供响应式数据
  innovationApp.provide("tableStyle", tableStyle); // 提供响应式数据
  innovationApp.use(Antd);
  innovationApp.mount(appContainer); // 将 Vue 应用挂载到子元素上
  console.log("AccountTable");

  container.style.position = "relative";
  overlay.appendChild(appContainer); // 将子元素添加到 overlay 中
  container.appendChild(overlay); // 将 overlay 添加到 container 中
}